package constants

import (
	"lesson01/instructions/base"
	"lesson01/rtda"
)

type BIPUSH struct {
	val int8
}

func (e *BIPUSH) FetchOperands(reader *base.BytecodeReader) {
	e.val = reader.ReadInt8()
}
func (e *BIPUSH) Execute(frame *rtda.Frame) {
	i := int32(e.val)
	frame.OperandStack().PushInt(i)
}

// SIPUSH Push short
type SIPUSH struct {
	val int16
}

func (e *SIPUSH) FetchOperands(reader *base.BytecodeReader) {
	e.val = reader.ReadInt16()
}
func (e *SIPUSH) Execute(frame *rtda.Frame) {
	i := int32(e.val)
	frame.OperandStack().PushInt(i)
}
